Validate xml file authenticity
I am sending out a standalone player that uses an xml driven image gallery. I need to prevent changes to the xml file to stop images being added to the gallery. I can can password protect the xml file to prevent changes, but I also wondered if there was a way to validate the authenticity of the xml file from within Flash to prevent the entire file being replaced?
Brian
First of all, if you password encrypt the xml file, and that file is replaced, it probably is not encrypted anymore, or another key is used. That would result in an error, which should be enough to send out a warning to the user.
As an alternative, you can use an MD5 hash. You use the original XML file to create the hash, and when you read the file the hash should be the same. I don't think that this is any safer or better than your solution. Yeah someone could decompile the movie, replace the hash, but how many of your users will have the knowledge and time to do something like this?
Similar Messages
-
How to validate xml file with XSD schema ?? in JDK1.4.2
How to validate xml file with XSD schema ?? in JDK1.4.2
i dont want to use new Xerec Jar ...
Suggest option ...Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
Then use Stax (Woodstock) or Saxon.
- Saish -
I am wondering if there is a way to validate XML file without using the <!DOCTYPE... but pass in the location of the schema/DTD file as a parameter to a validating method?
thanksNone that I know of. The only thing close is to use the EntityResolver interface where you can modify the location of the DTD file before it's being loaded and parsed, but that requires a <!DOCTYPE ...> in the XML file.
Good luck. -
How to validate xml file ?
I try to validate my xml import file but I can't find proper validation and error message.
the source where it originates is a system where also texts can be entered manually which are part of the xml file.
I discoverd myself that & and ! are characters which are not allowed. but I'm looking for a way to check this before I process the xml file.
I have this coding and I found smum_xml_parse but still the error is not clear about what is wrong ?
try.
CALL TRANSFORMATION ('ID')
SOURCE XML it_xml_import
RESULT order_header_in = st_sdhd1 order_conditions_in = ta_cond order_partners = ta_parnr order_text = ta_sdtext order_items_in = ta_sditm
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
ASSIGN COMPONENT 'ERROR' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = xslt_message.
data: gt_temp type STANDARD TABLE OF SMUM_XMLTB.
itx_xml_import = it_xml_import.
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
xml_input = itx_xml_import
tables
xml_table = gt_temp
return = ta_ret2
ENDTRY.
the xslt_message is also very unclear of what is exactly wrong with the file.
are there any function which can give me more detailed information about the xml file and what is wrong with it ?
Edited by: A. de Smidt on Feb 1, 2010 10:34 AMThe ampersand is not allowed in XML CDATA, you must use the entity &amp;
-
How do you validate XML file against a Schema?
Are there free applications that does that?
Thanks, but how do you validata the Schema itself, which is an XML file.
I know the schema DTD is online, but still I need some utility to do it
Thanks -
Jazn-data.xml file, authentication in web.xml and embedded oc4j
I've defined new security-roles, security-constraints and an authentication method in my web.xml file and i've created a new jazn-data.xml file that holds the different users and their groups.
If I want to link the security-roles of the web.xml file to the roles in the jazn-data.xml file I always need an orion-application.xml file, is this correct?
If I want to deploy an application as this to the embedded container the security won't work, I'm always getting the '403 forbidden' page.
Can somebody point me out how I need to define security for an embedded and standalone environment when using authentication and jazn-data.xml file + how do I deploy this to a standalone oc4j and how to get this same application to work in the embedded oc4J.hi "romanna"
Part of the answer to "Can somebody point me out how I need to define security ..." can probably be found in the "Oracle ADF Developer's Guide" that has "18 Adding Security to an Application".
success
Jan -
Hi
My problem is that I'm not able to validate my xml file using example code taken from java.sun.com page:
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/package-summary.html
The source code is:
// parse an XML document into a DOM tree
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(new File("instance.xml"));
// create a SchemaFactory capable of understanding WXS schemas
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// load a WXS schema, represented by a Schema instance
Source schemaFile = new StreamSource(new File("mySchema.xsd"));
Schema schema = factory.newSchema(schemaFile);
// create a Validator instance, which can be used to validate an instance document
Validator validator = schema.newValidator();
// validate the DOM tree
try {
validator.validate(new DOMSource(document));
} catch (SAXException e) {
// instance document is invalid!
}My XSD file:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/schema" xmlns:tns="http://www.example.org/schema">
<element name="parent">
<complexType>
<sequence maxOccurs="unbounded" minOccurs="0">
<element name="child" type="string"></element>
</sequence>
</complexType>
</element>
</schema>..and my XML file:
<?xml version="1.0" encoding="UTF-8"?>
<tns:parent xmlns:tns="http://www.example.org/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/schema schema.xsd ">
</tns:parent>..and the error message:
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'tns:parent'.
at com.sun.org.apache.xerces.internal.jaxp.validation.Util.toSAXParseException(Util.java:109)
at com.sun.org.apache.xerces.internal.jaxp.validation.ErrorHandlerAdaptor.error(ErrorHandlerAdaptor.java:104)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1944)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:335)
at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1020)
at org.apache.xml.utils.TreeWalker.startNode(TreeWalker.java:347)
at org.apache.xml.utils.TreeWalker.traverse(TreeWalker.java:159)
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:337)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.process(ValidatorImpl.java:220)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:141)
at javax.xml.validation.Validator.validate(Validator.java:82)
at main.XMLValidation.main(XMLValidation.java:42)I've lost any ideas. What's wrong?????????? HELP
aniaI am also using rsaft_pt_xml to generate audit file for Protugal project. The xml file losing </auditfile> and </masterfile> tag. In that case, the xml file can not be display correctly. We also have patched the sap notes to "1543036 - SAFT-PT Corrections RSAFT_PT_XML for 2010 (16)", but it does not work. Do you know how to solve this issue?
-
Validate XML file using nested XSD's
Hi,
I am currently trying to create a method that can validate a XML document based on a long series of nested XSD's.
I am however not sure of how to implement this validation with the nested XSD's.
Currently I have created the following function:
public void validate(InputStream xmlDocument) {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser sp = spf.newSAXParser();
InputStream schema1 = this.getClass().getResourceAsStream("schema.xsd");
InputStream schema2 = this.getClass().getResourceAsStream("schema1.xsd");
Object[] schemas = {schema1,schema2};
final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
sp.setProperty(JAXP_SCHEMA_SOURCE, schemas);
sp.parse(xmlDocument, new ParseErrorHandler());
} catch (SAXException e) {
System.out.println(e.toString());
} catch (ParserConfigurationException e) {
System.out.println(e.toString());
} catch (IOException e) {
System.out.println(e.toString());
The schemas that I reference are imported into the namespace of the class that contains the above method. schema.xsd contains a reference to schema1.xsd.
The exception that I get is:
com.sap.engine.lib.xml.parser.NestedSAXParserException: Generic Exception: -> com.sap.engine.lib.xml.util.NestedException: [location : null] ERROR : schema1.xsd (The system cannot find the file specified)
This I dont understand since the schema1.xsd is located right along with schema.xsd which is found without trouble.
Hope someone can clearify this issue for me, since I'm somewhat lost.
Best regards,
DanielHi,
I am currently trying to create a method that can validate a XML document based on a long series of nested XSD's.
I am however not sure of how to implement this validation with the nested XSD's.
Currently I have created the following function:
public void validate(InputStream xmlDocument) {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser sp = spf.newSAXParser();
InputStream schema1 = this.getClass().getResourceAsStream("schema.xsd");
InputStream schema2 = this.getClass().getResourceAsStream("schema1.xsd");
Object[] schemas = {schema1,schema2};
final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
sp.setProperty(JAXP_SCHEMA_SOURCE, schemas);
sp.parse(xmlDocument, new ParseErrorHandler());
} catch (SAXException e) {
System.out.println(e.toString());
} catch (ParserConfigurationException e) {
System.out.println(e.toString());
} catch (IOException e) {
System.out.println(e.toString());
The schemas that I reference are imported into the namespace of the class that contains the above method. schema.xsd contains a reference to schema1.xsd.
The exception that I get is:
com.sap.engine.lib.xml.parser.NestedSAXParserException: Generic Exception: -> com.sap.engine.lib.xml.util.NestedException: [location : null] ERROR : schema1.xsd (The system cannot find the file specified)
This I dont understand since the schema1.xsd is located right along with schema.xsd which is found without trouble.
Hope someone can clearify this issue for me, since I'm somewhat lost.
Best regards,
Daniel -
How to validate XML files using several XSD?
hi friends i need java code for this application >?
Plz. help me urgent............Use the parser property
http://apache.org/xml/properties/schema/external-schemaLocation
to specify more than one schemas.
http://xerces.apache.org/xerces2-j/properties.html -
XML DB: As XML file size doubles validate time more than doubles
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
We have default XMLDB install. I am using schemavalidate() to successfullly validate xml files against a registered xsd. For some reason as the files size doubles the time to validate the file grows at a faster rate than double? We wanted to generate approx 18MB files since they hold 5000 records. But as you can see it appears I would be better off generating six 3MB files instead. What init.ora or xdbconfig.xml parameter might I change to help out with behavior? Any other ideas of why this happening? Is this an example of "doesn't scale"?
1.5MB 3 Seconds
3MB 15 Seconds
6MB 1 Minute
12MB 6 Minutes
18MB 16 Minutes
Code is simple..
procedure validate_xml_file (p_dir in varchar2, p_file in varchar2) is
v_xmldoc xmltype;
begin
select XMLTYPE(bfilename(p_dir, p_file),NLS_CHARSET_ID('AL32UTF8'))
into v_xmldoc
from dual;
v_xmldoc.schemaValidate();
end validate_xml_file;If I take the clause off the end of the cview table this procedure does not work at all.. It fails at the schemavalidate call...
Error report:
ORA-19030: Method invalid for non-schema based XML Documents.
ORA-06512: at "SYS.XMLTYPE", line 345
ORA-06512: at line 26
19030. 00000 - "Method invalid for non-schema based XML Documents."
*Cause: The method can be invoked on only schema based xmltype objects.
*Action: Don't invoke the method for non schema based xmltype objects. -
How to validate an XML file with XSD Schema on JDK 1.4
Hi
I'm looking for samples how to validate xml files with xsd schema using jsdk 1.4
Thank you.This is how.
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
dbfac.setNamespaceAware(true);
SchemaFactory factory1 = SchemaFactory
.newInstance("http://www.w3.org/2001/XMLSchema");
Schema schema = factory1.newSchema(new File("person.xsd"));
dbfac.setSchema(schema);
DocumentBuilder dbparser1 = dbfac.newDocumentBuilder();
Document doc1 = dbparser1.parse(new File("person.xml"));
Validator validator1 = schema.newValidator();
DOMSource dm1 = new DOMSource(doc1);
DOMResult domresult1 = new DOMResult();
validator1.validate(dm1, domresult1); -
How can I compare the actual and expected values in Unit testing when they are XML files?
I have created a unit test for a method in VS 2008. My expected value and actual value are XMLs. Therefore though the output is same as I expect it gives an error as I am doing string comparison now. How can I compare these 2 XMLs in expected output and
actual output format in Unit Testing?
mayooran99In unit test, when you want to validate XML files, you feed them into the class / struct that you want to feed the XML into and compare the values there (You don't just feed it in XMLReader and feed it line by line, right? But if it really is, that's how
you should also test it in unit tests).
In short, how you'd use the XML in your code, that's how you should test it in unit test. -
Create an XML file from XSD file in JDeveloper
Hi,
I am working on XML DTD and XSD to validate xml file using JDeveloper.
1. How we can create xml file from XSD in JDeveloper.
2. How to design content model very easily..
3. where can I learn XSD easily.. any URL
can anyone help out..
with regards
Abu SufianThe XML node in the new gallery has an option to create XML document from schema
See this demo:
http://www.oracle.com/technology/products/jdev/viewlets/1013/xml_viewlet_swf.html
There are several places on the Web that teaches XSD
for example: http://www.w3schools.com/schema/ -
Error in xml file validation to its relevant xml schema
Hi All,
I have 3 xml schema files files from which I generated a XML file using PLSQL.I am getting this error when I am trying to validate xml file to the schema:
*'WMWROOT' NOT DECLARED*.Can anyone help me with this,I am including the main schema file and also the XML generated.
XML Schem file:
Itemdownload.xsd:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="ItemDownload" targetNamespace="http://www.manh.com/ILSNET/Interface" elementFormDefault="qualified"
xmlns="http://www.manh.com/ILSNET/Interface" xmlns:xs="http://www.w3.org/2001/XMLSchema" version ="2007">
<xs:include schemaLocation="Item.xsd" />
<xs:element name="WMWROOT" nillable="true" type="WMWROOT" />
<xs:complexType name="WMWROOT">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="WMWDATA" type="WMWDATA" />
</xs:sequence>
</xs:complexType>
<xs:element name="WMWDATA" nillable="true" type="WMWDATA"/>
<xs:complexType name="WMWDATA">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Items" type="ItemList" />
</xs:sequence>
</xs:complexType>
<xs:element name="Items" nillable="false" type="ItemList" />
<xs:complexType name="ItemList">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="Item" nillable="true" type="Item" />
</xs:sequence>
</xs:complexType>
</xs:schema>
The generated xml file is:
<?xml version="1.0" ?>
<WMWROOT>
<WMWDATA>
<Items>
<Item><Action>Save</Action><UserDef8>10074</UserDef8><Active>Y</Active><AvailableOnWeb>N</AvailableOnWeb><Company>OU: ResMed Corp</Company><Cost>285.93</Cost><Desc>HP DESKJET PRINTER (EMBLA)</Desc><HarmCode><UserDef8>10074</UserDef8></HarmCode><Item>R145-794</Item><InventoryTracking>Y</InventoryTracking><LongDesc>HP DESKJET PRINTER (EMBLA)</LongDesc><LotControlled>Y</LotControlled><SerialNumTrackOutbound>7</SerialNumTrackOutbound><StorageTemplate><Template>Each</Template></StorageTemplate><XRefs><XRef><XRefItem></XRefItem></XRef></XRefs></Item>
<Item><Action>Save</Action><UserDef8>80862</UserDef8><Active>Y</Active><AvailableOnWeb>N</AvailableOnWeb><Company>OU: ResMed Corp</Company><Cost>54.27</Cost><Desc>Mirage Micro Mask MED&LG-Internet Pkg</Desc><HarmCode><UserDef8>80862</UserDef8></HarmCode><Item>16359</Item><InventoryTracking>Y</InventoryTracking><LongDesc>Mirage Micro Mask MED&LG-Internet Pkg</LongDesc><LotControlled>Y</LotControlled><SerialNumTrackOutbound>N</SerialNumTrackOutbound><StorageTemplate><Template>Each</Template></StorageTemplate><XRefs><XRef><XRefItem>619498163597</XRefItem></XRef></XRefs></Item>
</Items>
</WMWDATA>
</WMWROOT>
I can provide you with the other 2 dependent schemas if needed.Please reply me!!Hey,
As you said I tried keeping the namespace in xml file and it worked for a strange reason I am getting the same error again,I am not able to figure it why!!
The error is:
SAMPLEITEMDLFILE.xml:2,139: no declaration found for element 'WMWROOT'
The XML document SAMPLEITEMDLFILE.xml is NOT valid (1 errors)
This is the part of PL/SQL code thru which I am generating the xml:
UTL_FILE.put_line (l_out_file, '<?xml version="1.0" ?>');
UTL_FILE.put_line (l_out_file, '<WMWROOT');
UTL_FILE.put_line (l_out_file, 'xmlns="http://www.manh.com/ILSNET/Interface"> ');
UTL_FILE.put_line (l_out_file, '<WMWDATA>');
UTL_FILE.put_line (l_out_file, '<Items>');
I am validating it in stylus studio tool.
Can you please help me thru this? -
Validate XML using XSD (XML Schema)
Hi experts.
Is there any way in ABAP to validate XML file against specified XSD file?
I found only possibility to validate against DTD, but no XSD. As far as I know this is only possible in Java, or is a part of XI. Is it doable without Java or XI (on NetWeaver 2004s)?
Help appreciated (and rewarded).
Regards, Frantisek.Hello
Perhaps you missed this link: [How to Perform XML Validations in SAP NetWeaver Process Integration 7.1|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1]
Regards
Uwe
Maybe you are looking for
-
How do I use AppleScript Editor to assign genders in Address Book?
I really wish Address Book was simple & just had a field for gender--but whatever. There are several things I want to do; if anyone can give my some guidance or maybe direct me to somewhere that can help me with these scripts, that'd be great. I'll j
-
My iphone 4s' screen is broken. I haven't dropped it or anything, or else it must've shown through its physical appearance. It just went into hazy white and green and now i cannot use it. Can i have a replacement for it? Thanks
-
Create a filename based on form content
Hello, I always have a hard time explaining my question's but here goes. I have a button which saves a form once filled out. I would like to take the thinking out of this when it comes to naming the file and it create the name based on a numerical fi
-
CMS gets hang when configure TACACS
Hi I have stack of 2950 switches. I have configure tacacs for login security purpose. but i am facing problem when i open CMS web interface. I am succussfully get authenticated. but its get hang when Discovering network information dialog box comes.
-
*** Msg in my Inbox won't delete
I'm seeing the strangest behavior from only 1 message in my inbox. Whenever I try to delete it, it turns pale gray. If I try to hit delete again, nothing happens and it doesn't go away. With the pale gray message selected the delete button now says "