Ejemplo n.º 1
0
std::vector< Result > MetaAttributesPresent::ValidateXml(
    const xc::DOMDocument &document,
    const fs::path& )
{
    std::vector< QName > allowed_attributes;
    allowed_attributes.push_back( QName( "id", "" ) );
    allowed_attributes.push_back( QName( "lang", MAIN_XML_NAMESPACE ) );
    allowed_attributes.push_back( QName( "name", "" ) );
    allowed_attributes.push_back( QName( "content", "" ) );
    allowed_attributes.push_back( QName( "scheme", "" ) );

    QName element_qname( "meta", OPF_XML_NAMESPACE );

    std::vector< Result > allowed_results = HasOnlyAllowedAttributes( 
        element_qname, allowed_attributes, document );

    std::vector< QName > mandatory_attributes;
    mandatory_attributes.push_back( QName( "name", "" ) );
    mandatory_attributes.push_back( QName( "content", "" ) );

    std::vector< Result > mandatory_results = HasMandatoryAttributes(   
        element_qname, mandatory_attributes, document );

    return Util::Extend( allowed_results, mandatory_results );
}
Ejemplo n.º 2
0
std::vector< Result > ItemAttributesPresent::ValidateXml(
    const xc::DOMDocument &document,
    const fs::path& )
{
    std::vector< QName > allowed_attributes;
    allowed_attributes.push_back( QName( "id",                 "" ) );
    allowed_attributes.push_back( QName( "href",               "" ) );
    allowed_attributes.push_back( QName( "media-type",         "" ) );
    allowed_attributes.push_back( QName( "fallback",           "" ) );
    allowed_attributes.push_back( QName( "fallback-style",     "" ) );
    allowed_attributes.push_back( QName( "required-namespace", "" ) );
    allowed_attributes.push_back( QName( "required-modules",   "" ) );
    
    QName element_qname( "item", OPF_XML_NAMESPACE );

    std::vector< Result > allowed_results = HasOnlyAllowedAttributes( 
        element_qname, allowed_attributes, document );

    std::vector< QName > mandatory_attributes;
    mandatory_attributes.push_back( QName( "id",         "" ) );
    mandatory_attributes.push_back( QName( "href",       "" ) );
    mandatory_attributes.push_back( QName( "media-type", "" ) );

    std::vector< Result > mandatory_results = HasMandatoryAttributes(   
        element_qname, mandatory_attributes, document );

    return Util::Extend( allowed_results, mandatory_results );
}