-
-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add ElementDecl
s to an internal subset
#1639
Comments
Pardon me, if this makes no sense, but this would also allow something like this? <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mydoc SYSTEM "mydoc.dtd" [
<!ENTITY foo SYSTEM "./foo.xml">
]>
<root>&foo;</root>
]> I'm having a hard time to understand how to get this using |
Similarly for Side note: libxml2 does not support adding As a workaround for anyone who comes across this limitation: a way to work around this, suggested in this SO post is to create a new doc by parsing the desired DTD, and then build the desired DOM tree within that document. |
Interesting side note: the JRuby implementation's parser, Xerces, does not support modifying the doctype! https://xerces.apache.org/xerces-j/apiDocs/org/w3c/dom/Document.html#getDoctype() So this is a feature that can only be implemented in CRuby, as far as I know. |
The use case is transforming this XML:
into this XML (note the additional element definition within the DTD):
Nokogiri doesn't have any functionality to create or manipulate element declarations. The ElementDecl class is pretty much read-only, meaning that if your XML has one, you can parse and inspect it.
See original nokogiri-talk thread for more details.
The text was updated successfully, but these errors were encountered: