Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM 1.0 alpha 1 is here

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Bradley S. Huffman" <hip AT cs.okstate.edu>
  • To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM 1.0 alpha 1 is here
  • Date: Thu, 10 Jun 2004 12:30:33 -0500

Hmmm after reading www.cafeconleche.org today, I think we are talking apples
and oranges, which is probably my fault since I'm not the best writer around.

So enough English, here's the Java of how I think the actual base URI should
be implemented. I don't think it's a push back, just a tweak for consistency.

Do with it what you wish :-)

Brad

diff -r -c XOM/src/nu/xom/Document.java XOM2/src/nu/xom/Document.java
*** XOM/src/nu/xom/Document.java Mon Jun 7 20:19:52 2004
--- XOM2/src/nu/xom/Document.java Thu Jun 10 10:41:46 2004
***************
*** 242,248 ****
+ " already has a parent");
}

- fillInBaseURI(oldRoot);
int index = indexOf(oldRoot);

oldRoot.setParent(null);
--- 242,247 ----
***************
*** 472,475 ****
}


! }
--- 471,474 ----
}


! }
diff -r -c XOM/src/nu/xom/Element.java XOM2/src/nu/xom/Element.java
*** XOM/src/nu/xom/Element.java Tue Jun 8 12:02:04 2004
--- XOM2/src/nu/xom/Element.java Thu Jun 10 10:42:03 2004
***************
*** 164,170 ****
this.attributes = element.attributes.copy();
}

! this.actualBaseURI = element.findActualBaseURI();

// non-recursive algorithm for filling in children
// doesn't yet work
--- 164,170 ----
this.attributes = element.attributes.copy();
}

! this.actualBaseURI = element.actualBaseURI;

// non-recursive algorithm for filling in children
// doesn't yet work
***************
*** 965,971 ****
Nodes result = new Nodes();
for (int i = 0; i < length; i++) {
Node child = getChild(i);
- if (child.isElement()) fillInBaseURI((Element) child);
child.setParent(null);
result.append(child);
}
--- 965,970 ----
diff -r -c XOM/src/nu/xom/ParentNode.java XOM2/src/nu/xom/ParentNode.java
*** XOM/src/nu/xom/ParentNode.java Mon Jun 7 20:52:28 2004
--- XOM2/src/nu/xom/ParentNode.java Thu Jun 10 12:21:10 2004
***************
*** 216,224 ****
);
}
Node removed = (Node) children.get(position);
- // fill in actual base URI
- // This way does add base URIs to elements created in memory
- if (removed.isElement()) fillInBaseURI((Element) removed);
children.remove(position);
removed.setParent(null);

--- 216,221 ----
***************
*** 227,245 ****
}


- void fillInBaseURI(Element removed) {
-
- ParentNode parent = removed;
- String actualBaseURI = "";
- while (parent != null && actualBaseURI.equals("")) {
- actualBaseURI = parent.getActualBaseURI();
- parent = parent.getParent();
- }
- removed.setActualBaseURI(actualBaseURI);
-
- }
-
-
/**
* <p>
* Removes the specified child of this node.
--- 224,229 ----
***************
*** 266,272 ****
"Child does not belong to this node"
);
}
- if (child.isElement()) fillInBaseURI((Element) child);
children.remove(position);

child.setParent(null);
--- 250,255 ----
diff -r -c XOM/src/nu/xom/XOMHandler.java XOM2/src/nu/xom/XOMHandler.java
*** XOM/src/nu/xom/XOMHandler.java Sun Jun 6 18:50:08 2004
--- XOM2/src/nu/xom/XOMHandler.java Thu Jun 10 10:44:53 2004
***************
*** 136,144 ****
// base URIs.
if (locator != null) {
String baseURI = locator.getSystemId();
! if (baseURI != null && !baseURI.equals(documentBaseURI)) {
! element.setActualBaseURI(baseURI);
! }
}

// Attach the attributes; this must be done before the
--- 136,142 ----
// base URIs.
if (locator != null) {
String baseURI = locator.getSystemId();
! element.setActualBaseURI(baseURI);
}

// Attach the attributes; this must be done before the
***************
*** 599,602 ****
}


! }
--- 597,600 ----
}


! }
Common subdirectories: XOM/src/nu/xom/benchmarks and
XOM2/src/nu/xom/benchmarks
Common subdirectories: XOM/src/nu/xom/canonical and XOM2/src/nu/xom/canonical
Common subdirectories: XOM/src/nu/xom/converters and
XOM2/src/nu/xom/converters
Common subdirectories: XOM/src/nu/xom/samples and XOM2/src/nu/xom/samples
Common subdirectories: XOM/src/nu/xom/tests and XOM2/src/nu/xom/tests
Common subdirectories: XOM/src/nu/xom/xerces and XOM2/src/nu/xom/xerces
Common subdirectories: XOM/src/nu/xom/xinclude and XOM2/src/nu/xom/xinclude
Common subdirectories: XOM/src/nu/xom/xslt and XOM2/src/nu/xom/xslt




Archive powered by MHonArc 2.6.24.

Top of Page