Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace schema reference in DOMDocument?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Can anyone help me with the following problem:

I need to receive an xml document from a third party that
may or may not have a schema reference xmlns="x-
schema:http/:validURL.xrd" included in the root node.

If the schema is correctly referenced then I can validate
with no problems, but I'm having difficulty with two other
scenarios:

1) The third party includes an incorrect schema reference

2) The third party doesn't include any schema reference.


I won't include my code, as I've been trying so many
things that it's all got very messy. But what I need to do
is to strip any invalid schema reference entirely,
validate according to the correct schema reference, and
save the xml to file (including the valid schema
reference).

My problems have included:

1) child nodes clipped from one DOMdocument inherit the
shema reference of the original parent, even if this is a
null reference. Replacing the namespace on the root node
leaves all child nodes with a reference to the original
schema.

2) Adding a schema to the collection gives me an error
of "no valid schema found" (sorry, thats a paraphrase)
when I attempt to validate. The schema IS valid and the
path is correct.

Any help available?
.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top